<?php
/**@package     Joomla.Site
 * @subpackage  mod_booking
 * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt*/
defined('_JEXEC') or die;
$baseurl = JUri::base();
$type 		= $params->get('type',	1);
$lang = JRequest::getVar('lang','');
$Itemid = JRequest::getVar('Itemid','101');
$db = JFactory::getDBO();

if($type==0){
	$sql="SELECT * from #__modules where id='88' and published=1";
	$db->setQuery($sql);
	$rows = $db->loadObjectList();
	$infomod=explode('header_class":"',$rows[0]->params);
	$infomod=explode('","',$infomod[1]);
	$infomod=explode('-',$infomod[0]);
?>
<section id="<?php echo $moduleclass_sfx ?>" class="cro_frontpage_img cro_frontpage_layout clearfix">
	<div class="cro_fpimg_block  animated  cro_fpimg1 flipInX cro_animnot" data-cro-anim-data="flipInX" data-cro-anim-delay="200">
		<div class="cro_imginner cro_imginner1"></div>
	</div>
	<div class="cro_fpimg_block  animated  flipInX cro_animnot" data-cro-anim-data="flipInX" data-cro-anim-delay="400">
		<div class="cro_fpimg_bottomcnt cro_cust_font">
			<div class="cro_fpimg_cntin">
					<?php echo JText::_('MOD_BOOKING_OPENING_TIME') ?>
			</div>
		</div>
		<div class="cro_fpimg_bottomblock">
            <div class="cro_imginner cro_imginner2">
            </div>
        </div>
    </div>
	<div class="cro_fpimg_block  animated   cro_fpimg3 flipInX cro_animnot" data-cro-anim-data="flipInX" data-cro-anim-delay="600">
		<div class="cro_imginner cro_imginner3">
        </div>
	</div>
	<div class="cro_fpimg_block  animated  flipInX cro_animnot" data-cro-anim-data="flipInX" data-cro-anim-delay="800">
		<div class="cro_fpimg_topblock">
            <div class="cro_imginner cro_imginner4">
            </div>
        </div>
		<div class="cro_fpimg_topcnt cro_cust_font">
			<div class="cro_fpimg_cntin">
				<?php echo JText::_('MOD_BOOKING_FOLLOW_US_ONLINE');?><br>
                <a target="_blank" href="https://www.facebook.com/TopoftheTownBarandRestaurant" class="icon-facebook"></a>
                <a target="_blank" href="https://plus.google.com/u/1/b/117711662210963431877/117711662210963431877/about" class="icon-googleplus"></a>
                <!--<a target="_blank" href="#" class="icon-pinterest"></a>-->
			</div>
		</div>
	</div>
</section>
<?php
}
if($type==1){
	$sql="SELECT * from #__content where catid='8' and state=1";
	$db->setQuery($sql);
	$rows = $db->loadObjectList();
?>
<section id="<?php echo $moduleclass_sfx ?>" class="cro_frontpage_pag cro_frontpage_layout  irorrldkts clearfix">
	<div class="container">
    	<div class="aboutdbout">
        	<div class="left">
                <?php echo $rows[0]->introtext;?>
            </div>
        	<div class="right">
            	<?php
					$urlimg=$rows[0]->images;
					$urlimg=explode('image_intro":"',$urlimg);
					$urlimg=explode('","',$urlimg[1]);
					$urlimg=str_replace('\/','/',$urlimg[0]);
				?>
                <img src="<?php echo $urlimg;?>" />
            </div>
        </div>
    </div>
</section>
<?php
}
if($type==2){
	$sqlcat="SELECT * from #__categories where note='delight' and published=1";
	$db->setQuery($sqlcat);
	$rowscat = $db->loadObjectList();

	$sqlarticle="SELECT * from #__content where catid='".$rowscat[0]->id."' and state=1";
	$db->setQuery($sqlarticle);
	$rowsarticle = $db->loadObjectList();
?>
<section id="menufood" class="cro_frontpage_fdm cro_frontpage_layout">
    <div class="container">
        <div class="cro_fdm_block">
            <h3 class="cro_cust_font cro_header"><?php echo $rowscat[0]->title;?></h3>
            <div class="cro_men_desc"><?php echo $rowscat[0]->description;?></div>
            <div class="fdm_outer">
            <?php
            for($i=0;$i<count($rowsarticle);$i++){
				$imgintro=explode('image_intro":"',$rowsarticle[$i]->images);
				$imgintro=explode('","',$imgintro[1]);
				$imgintro=str_replace('\/','/',$imgintro[0]);
			?>
            	<div class="fdm_menu_part<?php echo $i;?> fdm_menu_col  animated  fadeInUp cro_animnot" data-cro-anim-data="fadeInUp" data-cro-anim-delay="<?php echo ($i+1)*150;?>">
                    <div class="cro_menu_inside">
                    	<div class="imgintro">
                        	<img src="<?php echo $imgintro;?>" />
                            <div class="pricemenu">
                            	<span><?php echo $rowsarticle[$i]->metakey;?></span>
                            </div>
                        </div>
                        <div class="introtext">
                        	<h3><?php echo $rowsarticle[$i]->title;?></h3>
                            <?php echo $rowsarticle[$i]->introtext;?>
                        </div>
                    </div>
                </div>
            <?php
			}
			?>
            </div>
            <div class="btndownloadmenu"><a target="_blank" href="<?php echo $baseurl;?><?php echo $rowscat[0]->metakey;?>"><?php echo JText::_('Download  menu');?></a></div>
        </div>
    </div>
</section>
<?php
}
if($type==3){
	$sqlcat="SELECT * from #__categories where note='specials' and published=1";
	$db->setQuery($sqlcat);
	$rowscat = $db->loadObjectList();

	$sqlarticle="SELECT * from #__content where catid='".$rowscat[0]->id."' and state=1 order by ordering desc";
	$db->setQuery($sqlarticle);
	$rowsarticle = $db->loadObjectList();
?>
	<script>
	$(document).ready(function() {
		$(".popup").hide();
		$("#readmore0").click(function(e) {readmore0();});$("#readmore1").click(function(e) {readmore1();});$("#readmore2").click(function(e) {readmore2();});
		$("#readmore3").click(function(e) {readmore3();});$("#readmore4").click(function(e) {readmore4();});$("#readmore5").click(function(e) {readmore5();});
		$("#readmore6").click(function(e) {readmore6();});$("#readmore7").click(function(e) {readmore7();});$("#readmore8").click(function(e) {readmore8();});
		$("#readmore9").click(function(e) {readmore9();});$("#readmore10").click(function(e) {readmore10();});
		$(".mobilenav-close-close").click(function (e) {closePopup();e.preventDefault();});$("#background").click(function () {closePopup();});
	});
	</script>
<section id="specialofweek" class="cro_frontpage_cal cro_frontpage_layout">
	<div class="container">
		<?php
        for($i=0;$i<count($rowsarticle);$i++){
            $imgintro=explode('image_intro":"',$rowsarticle[$i]->images);
            $imgintro=explode('","',$imgintro[1]);
            $imgintro=str_replace('\/','/',$imgintro[0]);
            $datesp=explode('+',$rowsarticle[$i]->metakey);
        ?>
            <div id="popupreadmore<?php echo $i;?>" class="popup" style="width:76%;height:600px;">
                <div class="title">
                    <div class="contenthop">
                        <span class="titlelarge"><?php echo $rowsarticle[$i]->title;?></span>
                    </div>
                    <a href="#" class="mobilenav-close-close"/>x</a>
                </div>
                <div class="contentpopup" align="center" style="margin-top:20px">
                    <div class="contentsp">
                        <img style="max-width:55%;" src="<?php echo $imgintro;?>" />
                        <?php echo $rowsarticle[$i]->introtext.$rowsarticle[$i]->fulltext;?>
                    </div>
                </div>
            </div>
        <?php
        }
        ?>

    	<div class="large-12 columns  animated  fadeInUp cro_animnot">
        	<h3 class="cro_cust_font cro_header"><?php echo $rowscat[0]->title;?></h3>
            <div class="cro_directional">
                <div class="cro_wprev"> <i class="icon-chevron-left"></i></div>
                <div class="cro_wnext"><i class="icon-chevron-right"></i></div>
            </div>
            <ul class="cro_twister cro_agendatwister owl-carousel owl-theme" style="display:block;opacity:1;">
            <?php
            for($i=0;$i<count($rowsarticle);$i++){
				$imgintro=explode('image_intro":"',$rowsarticle[$i]->images);
				$imgintro=explode('","',$imgintro[1]);
				$imgintro=str_replace('\/','/',$imgintro[0]);
				$datesp=explode('+',$rowsarticle[$i]->metakey);
			?>
            	<li style="background:#fff;">
                    <div class="popover">
                        <div class="promoimg">
                        	<img src="<?php echo $imgintro;?>" />
                            <div class="agendadate">
                                <span class="first"><?php echo $datesp[0];?></span>
                                <span class="second"><?php echo $datesp[1];?></span>
                            </div>
                        </div>
                        <h5 class="cro_cust_font"><?php echo $rowsarticle[$i]->title;?></h5>
                        <p><?php echo $rowsarticle[$i]->introtext;?></p>
                        <div class="clarlabel"><a id="readmore<?php echo $i;?>" href="javascript:void(0);" class="cro_accent"><?php echo JText::_('MOD_BOOKING_READMORE');?></a></div>
                    </div>
                </li>
            <?php
			}
			?>
            </ul>
        </div>
    </div>
</section>
<?php
}
if($type==4){
	$sqlcat="SELECT * from #__categories where parent_id='11' and published=1";
	$db->setQuery($sqlcat);
	$rowscat = $db->loadObjectList();

	$sqlarticle="SELECT * from #__banners where catid='".$rowscat[0]->id."' and state=1";
	$db->setQuery($sqlarticle);
	$rowsarticle = $db->loadObjectList();
?>

<section id="gallery" class="cro_frontpage_gal" data-cro-showgals="6">
	<script language="javascript" type="text/javascript">
        var interactions_url    = '';
        var base_url            = '';
        var css_url             = '';
        var js_url              = '';
        var flash_url           = '';
        var img_url             = '';
        var image_cloud         = '';
        var device_env          =  4;
        var PAGE_DETAIL         =  1;
        document.domain = '';
    </script>
	<div class="blg_titlebg">
        <div class="container">
            <div class="large-12 columns">
				<h3 class="cro_cust_font cro_header"><?php echo $rowscat[0]->title;?></h3>
            	<div class="cro_men_desc"><?php echo $rowscat[0]->description;?></div>
				<div class="block_content_slide_showdetail">	
					<div id="article_content">  
						<?php
						for($i=0;$i<count($rowsarticle);$i++){
							$imgintro=explode('imageurl":"',$rowsarticle[$i]->params);
							$imgintro=explode('","',$imgintro[1]);
							$imgintro=str_replace('\/','/',$imgintro[0]);
						?>
						<div class="item_slide_show">
							<div class="block_thumb_slide_show">												
								<img data-reference-id="<?php echo $imgintro;?>" src="<?php echo $imgintro;?>" alt="" class="left" data-component-caption="<?php echo $rowsarticle[$i]->name;?>" />
								<a href="javascript:void(0)" class="btn_icon_show_slide_show">&nbsp;</a>
							</div>
							<div class="desc_cation">
								<p class="Normal">
								<?php echo $rowsarticle[$i]->name;?>
								</p>
							</div>
						</div> 
						<?php
						}
						?>		
					</div>          
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	if (typeof(common.resizeImagePhoto) != 'undefined') {
		common.resizeImagePhoto();
		$(window).resize(function() {
			common.delayFireOnce(1000).done(function() {
				common.resizeImagePhoto();
			});
		});
	}
	</script>
	<script src="templates/protostar/js/gallery/ImgFullscreen.js"></script>
	<script type="text/javascript">
		if(device_env != 1){
			$(function(){    
				if(typeof(sh_fullscreen) != "undefined"){
				sh_fullscreen.params = { 
					title: 'Slide Gallery', 
					lead: '',                  
					masterial: '',
					started: 0        };
				sh_fullscreen.run();
				}
			});
		}
		else{slideshow._init();}
		var article_title = '';
		var article_description = '';
		var article_image = '';
		$(document).ready(function() {
			if(typeof(ArticleShare) != "undefined"){
				ArticleShare.init();
				ArticleShare.SocialButtonLike();
			}
		});
	</script>
</section>

<!--<section id="gallery" class="cro_frontpage_gal" data-cro-showgals="6">
	<div class="blg_titlebg">
        <div class="container">
            <div class="large-12 columns">
				<h3 class="cro_cust_font cro_header"><?php echo $rowscat[0]->title;?></h3>
            	<div class="cro_men_desc"><?php echo $rowscat[0]->description;?></div>
                <ul class="cro_gallery_outer">
                	// <?php
					// for($i=0;$i<count($rowsarticle);$i++){
						// $imgintro=explode('imageurl":"',$rowsarticle[$i]->params);
						// $imgintro=explode('","',$imgintro[1]);
						// $imgintro=str_replace('\/','/',$imgintro[0]);

						// $imgintrolink=explode('.',$imgintro);
						// $imgintrolink=$imgintrolink[0].'a.'.$imgintrolink[1];
					// ?>
                        // <li  class=" animated "  data-cro-anim-data="fadeInUp"  data-cro-anim-delay="<?php echo ($i+1)*120;?>">
                            // <a href="<?php echo $imgintrolink;?>">
                                // <img src="<?php echo $imgintro;?>" alt="image" data-cro-title="<?php echo $rowsarticle[$i]->name;?>">
                            // </a>
                        // </li>
                    // <?php
					// }
					?>
                </ul>
			</div>
        </div>
    </div>
</section>-->
<?php
}
if($type==5){
	$sqlarticles="SELECT * from #__content where catid='13' and state=1";
	$db->setQuery($sqlarticles);
	$rowsarticles = $db->loadObjectList();
?>
	<script>
	$(document).ready(function() {
		$(".popup").hide();
		$("#readmoreproperties0").click(function(e) {readmoreproperties0();});$("#readmoreproperties1").click(function(e) {readmoreproperties1();});
		$("#readmoreproperties2").click(function(e) {readmoreproperties2();});$("#readmoreproperties3").click(function(e) {readmoreproperties3();});
		$("#readmoreproperties4").click(function(e) {readmoreproperties4();});$("#readmoreproperties5").click(function(e) {readmoreproperties5();});
		$("#readmoreproperties6").click(function(e) {readmoreproperties6();});$("#readmoreproperties7").click(function(e) {readmoreproperties7();});
		$("#readmoreproperties8").click(function(e) {readmoreproperties8();});$("#readmoreproperties9").click(function(e) {readmoreproperties9();});
		$("#readmoreproperties10").click(function(e) {readmoreproperties10();});$("#readmoreproperties11").click(function(e) {readmoreproperties11();});
		$("#readmoreproperties12").click(function(e) {readmoreproperties12();});$("#readmoreproperties13").click(function(e) {readmoreproperties13();});
		$("#readmoreproperties14").click(function(e) {readmoreproperties14();});$("#readmoreproperties15").click(function(e) {readmoreproperties15();});
		$("#readmoreproperties16").click(function(e) {readmoreproperties16();});$("#readmoreproperties17").click(function(e) {readmoreproperties17();});
		$("#readmoreproperties18").click(function(e) {readmoreproperties18();});$("#readmoreproperties19").click(function(e) {readmoreproperties19();});
		$("#readmoreproperties20").click(function(e) {readmoreproperties20();});$("#readmoreproperties21").click(function(e) {readmoreproperties21();});
		$("#readmoreproperties22").click(function(e) {readmoreproperties22();});$(".mobilenav-close-close").click(function (e) {closePopup();e.preventDefault();});
		$("#background").click(function () {closePopup();});
	});
	</script>
	<?php
    for($i=0;$i<count($rowsarticles);$i++){
        $imgintro=explode('image_intro":"',$rowsarticles[$i]->images);
        $imgintro=explode('","',$imgintro[1]);
        $imgintro=str_replace('\/','/',$imgintro[0]);
        $datesp=explode('+',$rowsarticles[$i]->metakey);
    ?>
        <div id="popupproperties<?php echo $i;?>" class="popup" style="width:76%;height:550px;">
            <div class="title">
                <div class="contenthop">
                    <span class="titlelarge"><?php echo $rowsarticles[$i]->title;?></span>
                </div>
                <a href="#" class="mobilenav-close-close"/>x</a>
            </div>
            <div class="contentpopup" align="center" style="margin-top:20px">
                <div class="contentsp">
                    <img style="max-width:55%;" src="<?php echo $imgintro;?>" />
                    <?php echo $rowsarticles[$i]->introtext.$rowsarticles[$i]->fulltext;?>
                </div>
            </div>
        </div>
    <?php
    }
    ?>

    <div id="home-portfolio-list" class="clearfix">
        <div id="portfolio" class="portfolio-normal clearfix">
        <?php
        for($i=0;$i<count($rowsarticles);$i++){
            $rowsimg=explode('image_intro":"',$rowsarticles[$i]->images);
            $rowsimg=explode('","',$rowsimg[1]);
            $rowsimg=str_replace('\/','/',$rowsimg[0]);
        ?>
            <div class="portfolio-item">
                <div class="portfolio-image">
                    <a id="readmoreproperties<?php echo $i;?>" href="javascript:void(0);"><img src="<?php echo $rowsimg; ?>" /></a>
                </div>
                <div class="portfolio-desc"><h3><a id="readmoreproperties<?php echo $i;?>" href="javascript:void(0);"><?php echo $rowsarticles[$i]->title; ?></a></h3></div>
            </div>
        <?php
        }
        ?>
        </div>
        <div class="portfolio-navigation">
            <a href="#" id="home-portfolio-prev" class="portfolio-prev"></a>
            <a href="#" id="home-portfolio-next" class="portfolio-next"></a>
        </div>
        <div id="home-portfolio-pagination"></div>
        <?php
        if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPad') == false){
			if(IsMobileBrowser()){
			?>
				<script type="text/javascript">
				jQuery("#portfolio").carouFredSel({
					circular:false,
					responsive:true,auto:false,
					items:{width:300,visible:{max:1}},
					scroll:{duration:900,easing:"easeOutExpo",wipe:true},
					prev:{button:"#home-portfolio-prev",key:"left"},
					next:{button:"#home-portfolio-next",key:"right"},
					pagination:"#home-portfolio-pagination"});
				</script>
			<?php
			}
			else{
			?>
				<script type="text/javascript">
				jQuery("#portfolio").carouFredSel({
					circular:false,
					responsive:true,auto:false,
					items:{width:300,visible:{min:1,max:4}},
					scroll:{duration:900,easing:"easeOutExpo",wipe:true},
					prev:{button:"#home-portfolio-prev",key:"left"},
					next:{button:"#home-portfolio-next",key:"right"},
					pagination:"#home-portfolio-pagination"});
				</script>
			<?php
			}
		}
		?>

    </div>
<?php
}
?>
<!--<div class="booking1<?php echo $moduleclass_sfx ?>"><?php echo $lineone; ?></div>
<div class="booking2<?php echo $moduleclass_sfx ?>"><?php echo JText::_('MOD_BOOKING_LINE2'); ?></div>-->
